import ApiBase from "../../api/moudles/ApiBase";

/**
 * 创建用于提交下载请求的form
 * @param self
 * @param tiyData
 * @param msgbody
 * @param url
 * @returns {HTMLFormElement}
 */
export function createDownloadForm(msgbody, url) {
  let requestMsg = ApiBase.createRequestMsg({});
  let downloadForm = document.createElement("form");
  downloadForm.style.display = "none";
  document.body.appendChild(downloadForm);
  let idInput = document.createElement("input");
  requestMsg.msgbody = msgbody;
  idInput.value = JSON.stringify(requestMsg);
  idInput.name = "requestMsg";
  downloadForm.appendChild(idInput);
  downloadForm.action = url;
  downloadForm.method = "post";
  return downloadForm;
}
